package cn.netjava.chapter6;

import java.io.*;


public class CopyFile1 {
	public boolean cp(String src,String dest)throws Exception
	{
		
		InputStream ins = new FileInputStream(src);
		OutputStream ous = new FileOutputStream(dest);
		
		int i = -1;
		while((i=ins.read())!=-1)
		{
			ous.write(i);
		}
		ous.flush();
		ins.close();
		ous.close();
		return true;
	}
	
	public static void main(String []args)throws Exception{
		CopyFile1 cf1 = new CopyFile1();
		cf1.cp("CopyFile1.java","bakFile.java");
	}
}
